class Solution {
public:
    int fib(int n) {
        if(n==0) return 0;
        if(n==1) return 1;
        int fir=0;
        int sec=1;
        int F;
        if(n>1)
        {
            for(int i=2;i<=n;i++)
            {
                F=fir+sec;
                fir = sec;
                sec = F;
            }
        }
        return F;
    }
};